﻿using System;
using Volo.Abp.Domain.Entities.Auditing;
using Joy.Erp.BasicArchives.Core.EntityAttributes;

namespace Joy.Erp.BasicArchives.Core
{
    public class ArchiveAggregateRoot<TKey> : FullAuditedAggregateRoot<TKey>, IArchiveAggregateRoot<TKey>
    {
        /// <summary>
        /// 编号
        /// </summary>
        [Unique]
        public virtual string Code { get; set; }

        /// <summary>
        /// 设置id
        /// </summary>
        /// <param name="id"></param>
        public virtual void SetId(TKey id) => Id = id;

        /// <summary>
        /// 来源类型
        /// </summary>
        public virtual string SourceType { get; set; }

        /// <summary>
        /// 来源主键
        /// </summary>
        public virtual string SourceKey { get; set; }

        /// <summary>
        /// 来源时间
        /// </summary>
        public virtual DateTime? SourceCreatedOn { get; set; }
    }

    public class ArchiveAggregateRoot : ArchiveAggregateRoot<Guid>, IArchiveAggregateRoot
    {
    }
}
